package io.renren.modules.business.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.renren.modules.business.entity.EApplyEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.modules.business.dao.EApplyDao;
import io.renren.modules.business.service.EApplyService;


@Service("eApplyService")
public class EApplyServiceImpl extends ServiceImpl<EApplyDao, EApplyEntity> implements EApplyService {

    @Autowired
    private EApplyDao eApplyDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<EApplyEntity> page = this.page(
                new Query<EApplyEntity>().getPage(params),
                new QueryWrapper<EApplyEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public IPage<List<Map>> queryApplyList(Integer pageNum, Integer pageSize, Long userId, Integer applyStatus) {
        Page page = new Page<>(pageNum, pageSize);
        return eApplyDao.queryApplyList(page, userId, applyStatus);
    }

}